package com.jueling.culture.service.impl;

import com.jueling.culture.core.AbstractService;
import com.jueling.culture.mapper.UserAuthorityMapper;
import com.jueling.culture.model.UserAuthority;
import com.jueling.culture.service.UserAuthorityService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author linp
 * @date  2022/02/18
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserAuthorityServiceImpl extends AbstractService<UserAuthority> implements UserAuthorityService {

    @Resource
    @SuppressWarnings("unused")
    private UserAuthorityMapper tUserAuthorityMapper;


    /**
     * 查询用户权限
     *
     * @param userId
     * @return
     */
    @Override
    public List<UserAuthority> getUserAuthorityList(String userId) {
        //获取用户权限集合
        Condition conditionAuthority = new Condition(UserAuthority.class);
        conditionAuthority.createCriteria().andEqualTo("userId",userId);
        return tUserAuthorityMapper.selectByCondition(conditionAuthority);
    }
}
